
const Class = require("./class");
const Person = require("./person");

class Teacher extends Person{
    constructor(id,name,age,klasses){
        super(id,name,age);
        this.klasses=klasses
    }
    introduce(){
        if(this.klasses)
        {
            let kls='Class ';
            for (let i=0; i<this.klasses.length;i++) {
                if(i!=this.klasses.length-1){
                    kls+=`${this.klasses[i].number}`
                }else
                kls+=`, ${this.klasses[i].number}`
            }
            return `${super.introduce()} I am a Teacher. I teach ${kls}.`
        }else{
            return `${super.introduce()} I am a Teacher. I teach No Class.`
        }
    }
    introduceWith(student){
        if(this.klasses.includes(student.klass))
        return `${super.introduce()} I am a Teacher. I teach ${student.name}.`
        else 
        return `${super.introduce()} I am a Teacher. I don't teach ${student.name}.`
    }
}
module.exports=Teacher



